/*
 * TextBufferCase.cpp
 *
 *  Created on: 2012-9-9
 *      Author: yangentao@gmail.com
 */

#include "test.h"

#include "../ed/TextBuffer.h"

class TextBufferTest: public TextBuffer, public testing::Test{

};

TEST_F(TextBufferTest, constructor){
	doAction(Action(0, 0, "a\nb\nc"));

	EXPECT_EQ(getLineCount(), 3);
}



TEST(TextBuffer, lines){
	String s = "a\nb\nc";
	TextBuffer text;
	text.setText(s);
	EXPECT_EQ(text.getLineCount(), 3);

	String line0 = text.getLineText(0);
	String line1 = text.getLineText(1);
	String line2 = text.getLineText(2);

	EXPECT_TRUE(line0.equals("a\n"))<<line0;
	EXPECT_TRUE(line1.equals("b\n"))<<line1;
	EXPECT_TRUE(line2.equals("c"));

}


